package com.wwj.app.v1;

import com.wwj.core.system.entity.Parameter;
import com.wwj.core.system.service.IParameterService;
import com.wwj.framework.controller.BaseController;
import com.wwj.framework.utils.ReturnData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/v1/param")
public class ParamController extends BaseController {
    @Resource
    private IParameterService parameterService;


    @RequestMapping("/{code}")
    @ResponseBody
    public ReturnData playerInfo(@PathVariable String code) {
        ReturnData returnData = new ReturnData();
        try {
            Parameter parameter = parameterService.findByCode(code);
            if (parameter == null) {
                returnData.failure("找不到运费信息，无法申请发货!");
                return returnData;
            }

            returnData.success(parameter);
        } catch (Exception e) {
            logger.error("", e);
            returnData.failure("系统错误,请联系客服");
        }
        return returnData;
    }
}
